#include "stdio.h"

int maxProduct(int *nums, int numsSize) {
    for (int i = 0; i < numsSize - 1; i++) {
        for (int j = i + 1; j < numsSize; j++) {
            if (nums[i] < nums[j]) {
                int temp = nums[j];
                nums[j] = nums[i];
                nums[i] = temp;
            }
        }
        if (i == 2) {
            return (nums[0] - 1) * (nums[1] - 1);
        }
    }
    return (nums[0] - 1) * (nums[1] - 1);
}

int main() {
    int a[] = {3, 4, 5, 2};
    printf("%d", maxProduct(a, 4));
}